
public class BinarySearch
{
    public static int list[] = {1,2,4,5,6,7,8,9};
    /**
     * @param args
     */
    public  static void printList() {
	for(int i = 0; i< list.length ;i++) {
	    System.out.print(list[i]+" ");
	}
    }

    public static void  binarySearch(int low, int high, int search){
	if(high < low) System.out.println("Not found");;
	int middle = low+(high- low) /2;
	if (list[middle]== search) {
	  System.out.println( middle);
	} else if (search > list[middle]){
	    binarySearch(middle+1,high,search);
	}else if (search < list[middle]){
	    binarySearch(low,middle-1,search);
	} 
	
    }
    public static void main(String[] args)
    {

	binarySearch(0,list.length -1 ,9);
	// TODO Auto-generated method stub

    }

}
